


Calculates surface-averaged EFs for PWE
The E field is specified as 3 [L x T] or [R x T] matrices
in the sturcture stE containing Ecr, Ect, and Esf
Ecr, Ect, Esf are discussed in the supplementary information.
This is a low-level function called by PweEsurf and PweEmap.
Parameters:
- stE: structure with fields (LR is L or R)
stE.Ecr: [LR x T]
stE.Ect: [LR x T]
stE.Esf: [LR x T]
stE.theta: [1 x T] row vector with theta's (equally-spaced
between 0 and pi)
Returns: same structure stE with the additional fields:
- stE.MLocParaAve: [LR x 1] wavelength- or r-dependent average MLocPara
- stE.MLocPerpAve: [LR x 1] wavelength- or r-dependent average MLocPerp
- stE.MLocAve: [LR x 1] wavelength- or r-dependent average MLoc
- stE.F0E4Ave: [LR x 1] wavelength- or r-dependent average SERS EF F^0_{E4}
- stE.F0E4PerpAve: [LR x 1] wavelength- or r-dependent average SERS EF
F^0_{E4} for perpendicular component
- stE.F0E4ParaAve: [LR x 1] wavelength- or r-dependent average SERS EF
F^0_{E4} for parallel component
This file is part of the SPlaC v1.0 package (copyright 2008)
Check the README file for further information

0001 theta=stE.theta; % [1 x T] 0002 nNbTheta=length(theta); % T 0003 0004 Ecr2theta=abs(stE.Ecr).^2; 0005 Ect2theta=abs(stE.Ect).^2; 0006 Esf2theta=abs(stE.Esf).^2; 0007 0008 if nNbTheta==1 0009 disp 'PweEFaverages: only one theta, all averages will be set to zero.' 0010 dtheta=0; 0011 else 0012 dtheta=pi/(nNbTheta-1); 0013 end 0014 sintcolnorm=(dtheta/2)*transpose(sin(theta)); % [T x 1] 0015 0016 % computes surface-averages (integrating 0017 % <f>=0.5*int(f(t)*sin(t)dt using a simple sums in the rectangle approximation) 0018 % Sums are computed as matrix [LR x T]* vector [T x 1] multiplication 0019 % All results are [LR x 1] 0020 0021 % average LFIEF 0022 stE.MLocPerpAve=1/2* Ecr2theta * sintcolnorm; 0023 stE.MLocParaAve=1/2* (Ect2theta +Esf2theta) * sintcolnorm; 0024 stE.MLocAve=stE.MLocPerpAve+stE.MLocParaAve; 0025 0026 % average SERS EF (E4 approximation) 0027 stE.F0E4Ave= ... 0028 (3/8* ( ((Ecr2theta+Ect2theta).^2+Esf2theta.^2) * sintcolnorm) + ... 0029 1/4* ( ((Ecr2theta+Ect2theta).*Esf2theta) * sintcolnorm) ); 0030 % average SERS EF (E4 approximation - perpendicular component only) 0031 stE.F0E4PerpAve= 3/8* (Ecr2theta.^2) * sintcolnorm; 0032 % average SERS EF (E4 approximation - parallel component only) 0033 stE.F0E4ParaAve= 1/8* ( (3*(Ect2theta.^2+Esf2theta.^2) + 2*Ect2theta.*Esf2theta) * sintcolnorm ); 0034